package com.minibobbo.utilities.spe.effectmodules;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.minibobbo.utilities.spe.SpeDynamicObject;
import com.minibobbo.utilities.spe.SpeObject;

public class SpeEffectSlice extends SpeEffectModule {

	@Override
	public void create(SpeDynamicObject parent) {
		this.parent = parent;
		affectedObjects.add(parent);
		duration = .3f;
//		loc.set(1, .2f).rotate(parent.facing.angle()).add(parent.loc.getCenter());
		loc.set(1, .2f);
		
		Vector2 place = new Vector2(loc.x + parent.loc.getCenter().x, loc.y + parent.loc.getCenter().y);
		area.setWithCenter(place.x, place.y, 1, .2f);

	}

	
	@Override
	public void checkHits(Array<SpeObject> objectsHit) {
		for (SpeObject o : objectsHit) {
		
			if(!affectedObjects.contains(o, false)) {
				SpeDynamicObject d = (SpeDynamicObject) o;
				if(d.loc.overlaps(area))
				d.dispose();
			}
		}

	}

}
